#pragma once

#include "Graph.h"
#include "FileType.h"

/*! \file GraphBuilder.h
	\brief Header file for GraphBuilder class.
	
	Details.
*/

#ifndef GRAPH_BUILDER
#define GRAPH_BUILDER

namespace analyzer {

	//! This class remember two values: matching and type of file
	class GraphBuilder
	{
	public:
		/*! \fn GraphBuilder(void)
			\brief Constructor of class GraphBuilder
		*/
		GraphBuilder(void);
		
		/*! \fn ~GraphBuilder(void)
			\brief Destructor of class GraphBuilder
		*/
		~GraphBuilder(void);
		
		/*! \fn std::pair<Vertex,bool>  addVertex(std::string vertexName, FileType fileType)
			\brief Method execute adding vertex to graph.
			\param vertexName Sets the vertex name.
			\param fileType Sets the type of file (enumeration: UNKNOWN_FILE, HEADER_FILE or SOURCE_FILE).
			\return Pair of Vertex and bool value. Boolean value: true - when adding is executed correctly or false - when the vertex name has already occurred.
		*/
		
		std::pair<Vertex,bool>  addVertex(std::string vertexName, FileType fileType);
		
		/*! \fn void addEdge(Vertex fromVertex, Vertex toVertex)
			\brief Method adding edge to vertices: fromVertex and toVertex.
			\param fromVertex First vertex in the created edge.
			\param toVertex  Second vertex in the created edge.
		*/
		void addEdge(Vertex fromVertex, Vertex toVertex);
		
		/*! \fn Vertex findEdge(std::string vertexName)
			\brief Method search the vertex with name from argument vertexName.
			\param vertexName Searching string name.
			\return Vertex type with the found name. 
		*/
		Vertex findEdge(std::string vertexName);
		
		/*! \fn void createNewGraph()
			\brief Method creates new graph and clears internal vertex names map, the user must manage deallocation of graph in all cases.
		*/
		void createNewGraph();
		
		/*! \fn Graph* getGraph()
			\brief Method returns pointer to created graph
			\return Pointer to graph
		*/
		Graph* getGraph();
		
	private:
		Graph* graph;
		VertexNameMap vertricesNames;
	};
}

#endif //GRAPH_BUILDER
